<%@ page contentType="text/html; charset=utf-8"%>
<%@page import="cn.org.timespace.easyframe.util.EfResourceContext"%>
<%@ include file="../commons/taglibs.jsp" %>
<%@ include file="../commons/css_js_head.jsp"%>
<html>
<head>
	
	<title>广州天绎物联网信息平台</title>
	
	<link href="${ctx }/css/login.css" rel="stylesheet" type="text/css" />

	<style>
	<!--
	body {
		font-family: Arial;
		font-size: 9pt;
	}
	
	.divlogin {
		position: absolute;
		z-index: 1002;
	}
	
	.divlogin-bg {
		position: absolute;
		z-index: 1001;
		background-repeat: no-repeat;
		background-image: url(images/bg_login.png);
		behavior: url("js/iepngfix.htc");
	}
	-->
	</style>

<script language="javascript">
	
document.onkeydown = function(e) {
	if (!e)
		e = window.event;//火狐中是 window.event
	if ((e.keyCode || e.which) == 13) {
		sumbitForm()
	}
}

function ajaxLogin(){
  
 
  $.ajax({
      type : "post",
      url : "/ajaxLoginAction.ts",
      cache: false,
      data : "&userAccount=",
      success : function(data){
      
      if( data == "true" )
       {
          window.location.href="/ajaxLoginAction.ts"
        }
       
      },
     error: function(){
     	   var innerHtml = "<span class='ts_red'>服务繁忙，请稍后再试！<\/span>";
           document.getElementById("fred").innerHTML=innerHtml;
           //txtObj.value = "";
           return false;
     	}
   });
}
function init() {
	var userAccount = document.getElementById("userAccount").value;
	if (userAccount == "" || userAccount == 0) {
		document.getElementById("userAccount").focus();
	} else {
		document.getElementById("userPassword").focus();
	}

}

function sumbitForm() {
	var userAccount = document.getElementById("userAccount").value;
	if (userAccount == "") {
		///alert('请输入登录帐号 !');
		document.getElementById("fred").innerHTML = "<span class='ts_red'>请输入登录帐号 ！<\/span>";
		document.getElementById("userAccount").focus();
		return;
	}

	var userPassword = document.getElementById("userPassword").value;
	if (userPassword == "") {
		// alert('请输入登录密码 !');
		document.getElementById("fred").innerHTML = "<span class='ts_red'>请输入登录密码 ！<\/span>";
		document.getElementById("userPassword").focus();
		return;
	}

	var authCode = document.getElementById("authCode").value;
	if (authCode == "") {
		//alert('请输入验证码 !');
		document.getElementById("fred").innerHTML = "<span class='ts_red'>请输入验证码 ！<\/span>";
		document.getElementById("authCode").focus();
		return;
	}
	document.forms[0].submit();
}

function con_code() {
	var getRandom = Math.random();
	document.getElementById("authImg").src = '${ctx}/efAuthCodeAction.ts?r=' + getRandom;
}

</script>

<link rel="Shortcut Icon" href="${ctx}/images/xf.ico" />
<link rel="Bookmark" href="${ctx}/images/xf.ico" />

<base target="_self">

</head>

<%
	String msg = (String) request.getAttribute("userAccount");
	if (msg == null || msg.length() == 0) {
		msg = "";
	}
%>

<body style='overflow: scroll; overflow-x: hidden; overflow-y: auto;' >

	<div id="Javascript.Div1" class="divlogin"
		style="width: 443px; height: 300px" align="left">
		<div class="loginbody">
			<div class="loginTB">
				<p class="fred" id="fred">
					<c:out value="${requestScope.globalErrMsgToPage }" />
				</p>
				
				<s:form action="/efLogonAction.ts" method="post">
				
				<table align="center" class="TB">
					<tr>
						<td>
							<img src="${ctx}/images/icon_name.gif">
						</td>
						<td>
							<input maxlength="50" name="userAccount" id="userAccount" type="text"
								class="input_name" tabindex="1" value="">
							<s:text name=""></s:text>
						</td>
						<td rowspan="2">
							<img src="${ctx}/images/bt_login.gif" alt="登录" border="0"
								onClick="sumbitForm()" style="cursor: pointer">
						</td>
					</tr>

					<tr>
						<td>
							<img src="${ctx}/images/icon_pw.gif">
						</td>
						<td>
							<input type="password" name="userPassword" id="userPassword" tabindex="2"
								class="input_name" value="">
						</td>

					</tr>
					<tr>
						<td>
							<img src="${ctx}/images/icon_yzm.gif">
						</td>
						<td colspan="2">
							<input type="text" name="authCode" id="authCode" class="input_yzm"
								tabindex="3">
							<img id="authImg" name="authImg" border="0" src="${ctx}/efAuthCodeAction.ts">
							看不清楚？
							<a href="#" onclick="con_code();">换一张图片！</a>
						</td>
					</tr>
					<tr>
					<td>
							测试说明：
						</td>
						<td colspan="2">
							管理员：admin 供应商：supply 运营商：wind
							密码：123
						</td>
					</tr>
				</table>
				</s:form>
			</div>
			<div class="copyright">
				Copyright &copy; 2011 广州天绎智能科技有限公司, All Rights Reserved.
			</div>
		</div>

	</div>
	<div id="Javascript.Div2" class="divlogin-bg"
		style="width: 443px; height: 300px" align="left"></div>

	<SCRIPT LANGUAGE="JavaScript">
function sc1(){
	document.getElementById("Javascript.Div1").style.top=document.body.scrollTop+(document.body.clientHeight-document.getElementById("Javascript.Div1").offsetHeight)/2
	document.getElementById("Javascript.Div1").style.left=document.body.scrollLeft+(document.body.clientWidth-document.getElementById("Javascript.Div1").offsetWidth)/2;
}

function sc2(){
	document.getElementById("Javascript.Div2").style.top=document.body.scrollTop+(document.body.clientHeight-document.getElementById("Javascript.Div1").offsetHeight)/2
	document.getElementById("Javascript.Div2").style.left=document.body.scrollLeft+(document.body.clientWidth-document.getElementById("Javascript.Div1").offsetWidth)/2;
}

function scall(){
	sc1();sc2();
	init();//聚焦
	//ajaxLogin();
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;

</SCRIPT>

</body>
</html>